/**
 * This class represents an order given by an administrator to a machine. An order is
 * represented by:
 * <ul>
 *   <li>An ID (same as in the database)
 *   <li>An userID (ID of the administrator, same as in the User table from database)
 *   <li>A machine hostname, which is concerned by the order
 *   <li>An order (e.g shutdown or reboot)
 * </ul>
 * @author Alexandre Dos Santos Coelho
 */
public class Order {
  private int id; // Order ID (same as in the database)
  private int userId; // ID of administrator who gave the order (same as in database)
  private String machineId; // Hostname of concerned machine
  private String order; // Order (e.g. shutdown or reboot)

  /**
   * Constructor. Creates a new order.
   * @param id ID (same as in the database)
   * @param userId userID (ID of the administrator, same as in the User table from database)
   * @param machineId machine hostname, which is concerned by the order
   * @param order order (e.g shutdown or reboot)
   */
  public Order(int id, int userId, String machineId, String order) {
    this.id = id;
    this.userId = userId;
    this.machineId = machineId;
    this.order = order;
  }

  /**
   * @return order ID
   */
  public int getId() {
    return id;
  }

  /**
   * @return the userID which gave the order
   */
  public int getUserId() {
    return userId;
  }

  /**
   * @return the concerned machine hostname
   */
  public String getMachineId() {
    return machineId;
  }

  /**
   * @param machineId the concerned machine hostname
   */
  public void setMachineId(String machineId) {
    this.machineId = machineId;
  }

  /**
   * @return the order
   */
  public String getOrder() {
    return order;
  }

  /**
   * @param order the order
   */
  public void setOrder(String order) {
    this.order = order;
  }

  /**
   * Returns a string with all order attributes
   * @return order
   */
  public String toString() {
    return "Order [id: " + id + ", user: " + userId + ", machine: " + machineId + ", order: " + order + "]";
  }
}
